<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport"
          content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no"/>
    <title>货款提现</title>
    <link rel="stylesheet" type="text/css" href="../css/aui.css"/>
    <link rel="stylesheet" type="text/css" href="../css/common.css"/>
    <style>
        body {
            background: #fff;
            font-size: 14px;
            overflow-x: hidden;
        }

        .money {
            color:#000;
            font-size:18px;
        }

        .title {
            width: 100%;
            display: block;
        }

        .time {
            color: #9c9c9c;
        }

        .shouru li {
            position: relative;
            padding:10px 7px;
        }

        .shouru li:before {
            border-bottom: 1px solid #9c9c9c;
            -webkit-transform: scale(0.5);
            position: absolute;
            bottom: 0;
            content: "";
            left: -100%;
            right: -100%;
        }

        .tixian {
            display: none;
        }

        .tixian li {
            position: relative;
            padding: 6px 0px;
        }

        .tixian li:before {
            border-bottom: 1px solid #9c9c9c;
            -webkit-transform: scale(0.5);
            position: absolute;
            bottom: 0;
            content: "";
            left: -100%;
            right: -100%;
        }
        .contain,.shouru,.list-content{
            overflow: hidden;
        }

        .my-list{
            width: 100%;
            text-align: center;
            overflow: hidden;
            margin: 0;
            color: #000;
        }
        .haderUl li:after{
            border: none !important;
        }
        .my-list li{
            padding: 0 15px;
            color: #666;

        }
        .my-list li span{
            float: left;
            display: block;

        }
        .my-list li span:nth-of-type(3){
            width: 50%;
            /*text-overflow: ellipsis;*/
            /*white-space:nowrap;*/
            /*overflow: hidden;*/

        }
        .my-list li span:nth-of-type(1),.my-list li span:nth-of-type(2){
            width: 25%;
            text-overflow: ellipsis;
            white-space:nowrap;
            overflow: hidden;

        }
        .my-list li{
            line-height: 45px;
            height: 45px;
        }
        .my-list li:nth-of-type(odd){
            background: #f8fdff;
        }
        /*.my-list li:first-of-type{*/
            /*background: #fff;*/
        /*}*/
        li.liShowData{
            height:inherit;
            line-height: inherit;
            padding-top: 12px;
            padding-bottom: 12px;
        }
    </style>
</head>
<body>
<div class=" contain ">
    <div class="shouru">
        <ul id="" class="my-list">
            <!-- data-type标识是否提现 2为提现-->
                <!--代理收入情况-->
            <li class="aui-list-view-cell aui-bg-default">
                <span>时间</span>
                <span>金额</span>
                <span>详情</span>
            </li>
        </ul>
        <div class="kongshuju">
            <p>暂无数据</p>
        </div>
        <ul id="list-content" class="my-list">
            <!--<li class="aui-list-view-cell">-->
                <!--<span class="payTime">ss</span>-->
                <!--<span>888</span>-->
                <!--<span class="aui-ellipsis-1" tapmode onclick="showHideData(this)"></span>-->
            <!--</li>-->
        </ul>
    </div>

    <div class="tixian ">
        <ul class="my-list">
            <!--提现明细-->
            <li class="aui-list-view-cell aui-bg-default">
                <span>时间</span>
                <span>提现金额</span>
                <span>提现详情</span>
            </li>
        </ul>
        <div class="kongshuju1">
            <p>暂无数据</p>
        </div>
        <ul id="tixian-content" class="my-list">
            <!-- data-type标识是否提现 2为提现-->
        </ul>
    </div>
</div>
<!--商家收入明细-->
<script id="supplier-template" type="x-dot-template">
    {{ for (var i in it) { }}
    <li class="aui-list-view-cell">
        <span class="payTime">{{=it[i].pay_time}}</span>
        <span>{{=it[i].supplier_gained}}</span>
        <span  class="aui-ellipsis-1" tapmode onclick="showHideData(this)">{{=it[i].pay_name}}</span>
    </li>
    {{ } }}
</script>
<!--代理收入明细模板-->
<script id="list-template" type="x-dot-template">
    {{ for (var i in it) { }}
    <li class="aui-list-view-cell">
        <span  class="payTime">{{=it[i].change_time}}</span>
        <span>{{=it[i].user_money}}</span>
        <span  class="aui-ellipsis-1" tapmode onclick="showHideData(this)">{{=it[i].change_desc}}</span>
    </li>
    {{ } }}
</script>
<!--提现收入明细模板-->
<script id="tixian-template" type="x-dot-template">
    {{ for (var i in it) { }}
    <li class="aui-list-view-cell">
        <span class="tixian-time">{{=it[i].add_time}}</span>
        <span>{{=it[i].amount}}</span>
        <span class="tixian-info aui-ellipsis-1"   tapmode onclick="showHideData(this)">{{=it[i].bankname}}</span>
    </li>
    {{ } }}
</script>
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/doT.min.js"></script>
<script type="text/javascript" src="../script/echo.js"></script>
<script type="text/javascript" src="../script/common.js"></script>
<script type="text/javascript" src="../script/myInfo.js"></script>
<script type="text/javascript" src="../script/jquery-1.11.3.js"></script>
<script type="text/javascript">
    var page = 1, isLock = false, type = 1;
    apiready = function () {
        api.parseTapmode();
        //第二个页面,接收监听--有跨页面传参数
        getStorageAll();
        getUserInfo();
        depositLog();
        getMoneyInfoList();

        api.addEventListener({
            name: 'moneyListType'
        }, function (ret) {
            if (ret && ret.value) {
                $("#list-content").empty();
                isLock = false;
                page = 1;
                type = ret.value.type;
                api.refreshHeaderLoading();
                return false;
            }
        });
//        api.setRefreshHeaderInfo({
//            visible: true,
//            loadingImg: 'widget://image/ptr_pull.png',
//            bgColor: '#efeff4',
//            textColor: '#959595',
//            textDown: '下拉刷新',
//            textUp: '松开刷新',
//            showTime: true
//        }, function (ret, err) {
//            isLock=false;
//            page = 1;
//            if (type == 1) {
//                getMoneyInfoList();
//            } else {
//                depositLog();
//            }
//        });
        //监听是否达到底部上拉加载
        api.addEventListener({
            name: 'scrolltobottom'
        }, function (ret, err) {
            page++;
            if (isLock == false) {
                getMoneyInfoList();
            }
        })
//        api.refreshHeaderLoading();

        api.addEventListener({
            name: 'updateUserInfo'
        }, function (ret) {
            if (ret && ret.value) {
                getStorageAll();
                getUserInfo();
                depositLog();
                getMoneyInfoList();
            }
        });
    }


    //收入明细
    function getMoneyInfoList() {
        if (isLock)return;
        isLock = true;
        showLoading()
        var url="";
        var tpl="";
        if(member_type=="agent"){
            url = "account/money_record";
            tpl = $api.byId('list-template').text;
        }else{
            url = "account/supplier_income";
            tpl = $api.byId('supplier-template').text;
        }
        var data = {};
        data['page'] = page;
        getStorageAll();
        ajaxRequest(url, 'get', data, function (ret, err) {
            hideLoading();
            isLock = false;
            var content = $api.byId('list-content');
//            var tpl = $api.byId('list-template').text;
            var tempFn = doT.template(tpl);
            if (page > 1) {
                if (!$.trim(ret.data)) {
                    return;
                }
                $api.append(content, tempFn(ret.data));
            } else {
                showNoTip(ret.data);
                $api.html(content, tempFn(ret.data));
            }
            $(".shouru").find(".payTime").each(function () {
                $(this).text(stampToTime($(this).text(),"true"))
            })
        });
    }

    //提现明细
    function depositLog() {
        var url = "account/withdraw_record";
        var data = {};
        data['type'] = member_type == "supplier" ? 2 : 4;
        getStorageAll();
        ajaxRequest(url, 'get', data, function (ret, err) {
            var content = $api.byId('tixian-content');
            var tpl = $api.byId('tixian-template').text;
            var tempFn = doT.template(tpl);
            if (page > 1) {
                if (!$.trim(ret.data)) {
                    return;
                }
                $api.append(content, tempFn(ret.data));
            } else {
                showNoTip1(ret.data);
                $api.html(content, tempFn(ret.data));
            }
            $("#tixian-content").find(".tixian-time").each(function () {
                $(this).text(stampToTime($(this).text(),"true"))
            })
            $("#tixian-content").find(".tixian-info").each(function (index) {
                var bankCarNO=ret.data[index]['banknumber'].substr(ret.data[index]['banknumber'].length-4,4)
                var status=ret.data[index]['is_paid']=="1"?"<em class='aui-text-info font-size-12  aui-pull-right'>已打</em>":"<em class='aui-text-danger  font-size-12 aui-pull-right'>审核</em>"
                $(this).html($(this).text().substr(0,4)+"("+bankCarNO+")"+status)
            })
//            setTimeout(function () {
//
//
//            },1000)
        });
    }
    function changeContent(type) {
        if (type == "shouru") {
            $(".shouru").show();
            $(".tixian").hide();
        } else {
            $(".shouru").hide();
            $(".tixian").show();
        }
    }
    function showHideData(obj) {
        if($(obj).hasClass("aui-ellipsis-1")){
            $(obj).removeClass("aui-ellipsis-1");
            $(obj).closest("li").addClass("liShowData");
        }else{
            $(obj).addClass("aui-ellipsis-1");
            $(obj).closest("li").removeClass("liShowData");
        }
    }
</script>
</html>